package cn.xiaomubiao.oschine.adapter.myinfo;

import android.view.View;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import cn.xiaomubiao.oschine.R;
import cn.xiaomubiao.oschine.bean.Messages;
import cn.xiaomubiao.oschine.util.StringUtils;
import cn.xiaomubiao.oschine.util.UIUtils;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * @author
 * @version 1.0
 * @date 2017/4/8
 */

public class MyInfoMessageLeaveMessageAdapter extends  MyInfoBaseListAdapter<Messages> {
    @Override
    protected void initItemView(View itemView, int position) {
        CircleImageView avatar = (CircleImageView) itemView.findViewById(R.id.iv_avatar);
        TextView name = (TextView) itemView.findViewById(R.id.name);
        TextView message = (TextView) itemView.findViewById(R.id.message);
        TextView time = (TextView) itemView.findViewById(R.id.time);
        TextView message_count = (TextView) itemView.findViewById(R.id.message_count);
        Messages messages = datas.get(position);
        Glide.with(UIUtils.getContext()).load(messages.getPortrait()).into(avatar);
        name.setText(messages.getFriendName());
        message.setText(messages.getContent());
        time.setText(StringUtils.friendly_time(messages.getPubDate()));
        message_count.setText(messages.getMessageCount()+"条留言");
        
    }

    @Override
    public int getLayoutId() {
        return R.layout.view_item_leavemessage2;
    }
}
